<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/8/16
 * Time: 10:20
 */
namespace app\index\controller;

use app\common\controller\HomeBase;  // model
use think\Db;                       // db
use think\Session;
use think\Request;

class Water extends HomeBase{
    /*
    水印图片
    */
    public function water_img(){
        //1 打开底图
        $img = \think\Image::open('./static/images/bk.jpg');
        dump($img->width());
        // 2 定位水印文字名字  离顶部300  fontawesome-webfont.woff
        $nowtime = time();
        $img->text('定位水印文字名字','./static/fonts/north.ttf',20,'#ffffff')->save('./upload/20180808/'.$nowtime.'.jpg');
    }

    /*

    */
    public function watt(){
        //1 打开底图
        $img = \think\Image::open('./static/images/bk.jpg');
        dump($img->width());
        // 2 定位水印文字名字  离顶部300  fontawesome-webfont.woff
        $nowtime = time();
        $img->text('定位水印文字名字','./static/fonts/north.ttf',20,'#ffffff')->save('./upload/20180808/'.$nowtime.'.jpg');
    }

    public function watt1(){
        //1 打开底图
        $img = \think\Image::open('./static/images/bk.jpg');
        dump($img->width());
        // 2 定位水印文字名字  离顶部300  fontawesome-webfont.woff
        $nowtime = time();
        $img->text('定位水印文字名字','./static/fonts/north.ttf',20,'#ffffff',\think\Image::WATER_SOUTHWEST,0,50)->save('./upload/20180808/'.$nowtime.'.jpg');
    }

    public function watt2(){
        //1 打开底图
        $img = \think\Image::open('./static/images/bk.jpg');
        dump($img->width());
        // 2 定位水印文字名字  离顶部300  fontawesome-webfont.woff
        $nowtime = time();
        $img->text('定位水印文字名字','./static/fonts/north.ttf',50,'#000000',\think\Image::WATER_SOUTHWEST,50,0)->save('./upload/20180808/'.$nowtime.'.jpg');
    }

    public function watt3(){
        //1 打开底图
        $img = \think\Image::open('./static/images/bk.jpg');
        dump($img->width());
        // 2 定位水印文字名字  离顶部300  fontawesome-webfont.woff
        $nowtime = time();
        $img->text('定位水印文字名字','./static/fonts/north.ttf',50,'#000000',\think\Image::WATER_NORTH,50,0)->save('./upload/20180808/'.$nowtime.'.jpg');
    }

    public function watt4(){
        //1 打开底图
        $img = \think\Image::open('./static/images/bk.jpg');
        dump($img->width());
        // 2 定位水印文字名字  离顶部300  fontawesome-webfont.woff
        $nowtime = time();
        $img->text('定位水印文字名字','./static/fonts/north.ttf',30,'#000000',\think\Image::WATER_NORTH,50,0)->save('./upload/20180808/'.$nowtime.'.jpg');
    }

    public function watt5(){
        //1 打开底图
        $img = \think\Image::open('./static/images/bk.jpg');
        dump($img->width());
        // 2 定位水印文字名字  离顶部300  fontawesome-webfont.woff
        $nowtime = time();
        $img->text('定位水印文字名字','./static/fonts/north.ttf',30,'#000000',\think\Image::WATER_NORTH,50,0)->save('./upload/20180808/'.$nowtime.'.jpg');
    }

    public function watt6(){
        //1 打开底图
        $img = \think\Image::open('./static/images/bk.jpg');
        dump($img->width());
        // 2 定位水印文字名字  离顶部300  fontawesome-webfont.woff
        $nowtime = time();
        $img->text('定位水印文字名字','./static/fonts/north.ttf',30,'#000000',\think\Image::WATER_NORTH,70,0)->save('./upload/20180808/'.$nowtime.'.jpg');
    }

    public function watt7(){
        //1 打开底图
        $img = \think\Image::open('./static/images/bk.jpg');
        dump($img->width());
        // 2 定位水印文字名字  离顶部300  fontawesome-webfont.woff
        $nowtime = time();
        $img->text('定位水印文字名字','./static/fonts/north.ttf',30,'#000000',\think\Image::WATER_NORTH,80,0)->save('./upload/20180808/'.$nowtime.'.jpg');
    }

    public function watt8(){
        //1 打开底图
        $img = \think\Image::open('./static/images/bk.jpg');
        dump($img->width());
        // 2 定位水印文字名字  离顶部300  fontawesome-webfont.woff
        $nowtime = time();
        $img->text('定位水印文字名字','./static/fonts/north.ttf',30,'#000000',\think\Image::WATER_NORTH,80,0)->save('./upload/20180808/'.$nowtime.'.jpg');
    }

// CENTER

    public function watt9(){
        //1 打开底图
        $img = \think\Image::open('./static/images/bk.jpg');
        dump($img->width());
        // 2 定位水印文字名字  离顶部300  fontawesome-webfont.woff
        $nowtime = time();
        $img->text('定位水印文字名字','./static/fonts/north.ttf',30,'#000000',\think\Image::WATER_CENTER,80,0)->save('./upload/20180808/'.$nowtime.'.jpg');
    }
    /*
    $location=array(100,200);
    $image->open($images[$i])->water($water,$location,0)->save($images[$i]);
    */
    public function watt10(){
        //1 打开底图
        $img = \think\Image::open('./static/images/bk.jpg');
        dump($img->width());
        // 2 定位水印文字名字  离顶部300  fontawesome-webfont.woff
        $nowtime = time();
        $img->text('定位水印文字名字','./static/fonts/north.ttf',30,'#000000',\think\Image::WATER_CENTER,80,0)->save('./upload/20180808/'.$nowtime.'.jpg');
    }

    public function watt11(){
        //1 打开底图
        $img = \think\Image::open('./static/images/bk.jpg');
        dump($img->width());
        // 2 定位水印文字名字  离顶部300  fontawesome-webfont.woff
        $nowtime = time();
        $img->text('定位水印文字名字','./static/fonts/north.ttf',30,'#000000',\think\Image::WATER_NORTH,90,0)->save('./upload/20180808/'.$nowtime.'.jpg');
    }

    public function watt12(){
        //1 打开底图
        $img = \think\Image::open('./static/images/bk.jpg');
        dump($img->width());
        // 2 定位水印文字名字  离顶部300  fontawesome-webfont.woff
        $nowtime = time();
        $locatt = array(10,10);

        $img->text('定位水印文字名字','./static/fonts/north.ttf',30,'#000000',$locatt,0,0)->save('./upload/20180808/'.$nowtime.'.jpg');
    }

    public function watt13(){
        //1 打开底图
        $img = \think\Image::open('./static/images/bk.jpg');
        dump($img->width());
        // 2 定位水印文字名字  离顶部300  fontawesome-webfont.woff
        $nowtime = time();
        $locatt = array(10,10);

        $img->text('定位水印文字名字','./static/fonts/north.ttf',30,'#000000',$locatt,0,0)->save('./upload/20180808/'.$nowtime.'.jpg');
    }
    /*
    水印文字到顶部
    */
    public function watt14(){
        //1 打开底图
        $img = \think\Image::open('./static/images/bk.jpg');
        dump($img->width());
        // 2 定位水印文字名字  离顶部300  fontawesome-webfont.woff
        $nowtime = time();
        $locatt = array(10,10);

        $img->text('定位水印文字名字','./static/fonts/north.ttf',30,'#000000',\think\Image::WATER_NORTH,0,0)->save('./upload/20180808/'.$nowtime.'.jpg');
    }

    /*
    水印文字到顶部  离顶部50
    */
    public function watt15(){
        //1 打开底图
        $img = \think\Image::open('./static/images/bk.jpg');
        dump($img->width());
        // 2 定位水印文字名字  离顶部300  fontawesome-webfont.woff
        $nowtime = time();
        $locatt = array(10,10);

        $img->text('定位水印文字名字','./static/fonts/north.ttf',30,'#000000',\think\Image::WATER_NORTH,50,0)->save('./upload/20180808/'.$nowtime.'.jpg');
    }

    /*
    水印文字到顶部  离顶部80
    */
    public function watt16(){
        //1 打开底图
        $img = \think\Image::open('./static/images/bk.jpg');
        dump($img->width());
        // 2 定位水印文字名字  离顶部300  fontawesome-webfont.woff
        $nowtime = time();
        $locatt = array(10,10);

        $img->text('水印文字名字','./static/fonts/north.ttf',26,'#000000',\think\Image::WATER_NORTH,80,0)->save('./upload/20180808/'.$nowtime.'.jpg');
    }

    /*
    水印文字到顶部  离顶部80
    */
    public function watt17(){
        //1 打开底图
        $img = \think\Image::open('./static/images/bk.jpg');
        dump($img->width());
        // 2 定位水印文字名字  离顶部300  fontawesome-webfont.woff
        $nowtime = time();
        $locatt = array(10,10);
        $offsett = array(80,0);
        $img->text('水印','./static/fonts/north.ttf',26,'#000000',\think\Image::WATER_NORTH,$offsett,0)->save('./upload/20180808/'.$nowtime.'.jpg');
    }

    /*
    水印文字到顶部  离顶部80
    */
    public function watt18(){
        //1 打开底图
        $img = \think\Image::open('./static/images/bk.jpg');
        dump($img->width());
        // 2 定位水印文字名字  离顶部300  fontawesome-webfont.woff
        $nowtime = time();
        $locatt = array(10,10);
        $offsett = array(80,0);
        $img->text('水印','./static/fonts/north.ttf',26,'#000000',\think\Image::WATER_NORTH,$offsett,0)->save('./upload/20180808/'.$nowtime.'.jpg');
    }

    /*
    水印文字到顶部  离顶部80
    */
    public function watt19(){
        //1 打开底图
        $img = \think\Image::open('./static/images/bk.jpg');
        dump($img->width());
        // 2 定位水印文字名字  离顶部300  fontawesome-webfont.woff
        $nowtime = time();
        $locatt = array(10,10);
        $offsett = array(0,80);
        $img->text('水印','./static/fonts/north.ttf',26,'#000000',\think\Image::WATER_NORTH,$offsett,0)->save('./upload/20180808/'.$nowtime.'.jpg');
    }

    /*
    水印内容
    */
    public function con01(){
        //1 打开底图
        $img = \think\Image::open('./static/images/bk.jpg');
        dump($img->width());
        echo $img->height();
        // 2 定位水印文字名字  离顶部300  fontawesome-webfont.woff
        $nowtime = time();
        $locatt = array(28,375);
        $offsett = array(0,0);
        $img->text('1. 睡觉睡觉','./static/fonts/north.ttf',26,'#000000',$locatt,$offsett,0)->save('./upload/20180808/'.$nowtime.'.jpg');
    }

}